//
//  View.m
//  MusouKit
//
//  Created by danal on 13-3-21.
//  Copyright (c) 2013年 danal. All rights reserved.
//

#import "View.h"

@implementation View

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

int counter = 0;
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
    CGContextRef c = UIGraphicsGetCurrentContext();
    
//    [[UIColor orangeColor] set];
//    float corner = 20.f;
//    CGContextAddRect(c, CGRectInset(rect, 30, 30));
//    //    先创建一个路径，然后根据这个路径创建了一个剪辑区域，接下来所有的绘制都会被限制在这个区域内，绘制在区域外的会不可见
//    CGContextClip(c);
//    
//    CGRectAddRoundedCornerPath(rect, corner, counter%5, c);
//    CGContextAddArc(c, rect.size.width/2, rect.size.height/2, 30, 0, M_PI, 1);
//    
//    CGContextFillPath(c);
//    counter++;
}


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self setNeedsDisplay];
}

@end
